import request from '@/utils/request'

export async function getRole(params: any = { pageNo: 1, pageSize: 10 }) {
  return await request({
    url: '/role/list',
    method: 'get',
    params,
  }).then((res: any) => {
    return {
      data: res.data.roleList,
      totalCount: res.data.totalCount,
    }
  })
}

export async function addRole(data: any) {
  return await request({
    url: '/role/create',
    method: 'post',
    data,
  })
}

export async function updateRole(data: any) {
  return await request({
    url: '/role/update',
    method: 'put',
    data,
  })
}

export async function deleteRole(data: any) {
  return await request({
    url: '/role/delete',
    method: 'delete',
    data,
  })
}
